package parser

import (
	"crawler/engine"
	"regexp"
)

var rex=regexp.MustCompile(`(http://m.zhenai.com/u/[^"]*)"`)
//<a href="http://album.zhenai.com/u/1368724723" target="_blank">*</a>
var page=regexp.MustCompile(`(http://m.zhenai.com/zhenghun/[^"]*)"`)

func ParserProfilList(contens []byte) engine.ParseResult{
    match:=rex.FindAllSubmatch(contens,-1)
	result:=engine.ParseResult{}
	for _,m:=range match{
		result.Requests=append(result.Requests,engine.Request{
			UrL:string(m[1]),
			ParserFunc:ParsePorfile,
		})
		result.Items=append(result.Items,nil)
	}
	pageUrl:=page.FindSubmatch(contens)
	if len(pageUrl) >0 {
		result.Requests=append(result.Requests,engine.Request{
			UrL:string(pageUrl[1]),
			ParserFunc:ParserProfilList,
		})
	}

	return result

}

